﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DEMO3.DTO;
using System.Data.SqlClient;

namespace DEMO3.DAO
{
    class CaChieuDAO
    {
        public DataTable Get()
        {
            DataProvider test = new DataProvider();
            return test.ExcuteQuery("GET_CACHIEU", null);
        }

        public bool Add(CaChieuDTO dto)
        {
            DataProvider test = new DataProvider();
            SqlParameter[] arrpara = new SqlParameter[3];
            arrpara[0] = new SqlParameter("MaCaChieu", dto.MaCaChieu);
            arrpara[1] = new SqlParameter("GioBatDau", dto.GioBD);
            arrpara[2] = new SqlParameter("GioKetThuc", dto.GioKT);
            return test.ExcuteNonQuery("ADD_CACHIEU", arrpara);
        }
        public bool Delete(CaChieuDTO dto)
        {
            DataProvider test = new DataProvider();
            SqlParameter[] arrpara = new SqlParameter[1];
            arrpara[0] = new SqlParameter("MaCaChieu", dto.MaCaChieu);
            return test.ExcuteNonQuery("DELETE_CACHIEU", arrpara);
        }
        public bool Update(CaChieuDTO dto)
        {
            DataProvider test = new DataProvider();
            SqlParameter[] arrpara = new SqlParameter[3];
            arrpara[0] = new SqlParameter("MaCaChieu", dto.MaCaChieu);
            arrpara[1] = new SqlParameter("GioBatDau", dto.GioBD);
            arrpara[2] = new SqlParameter("GioKetThuc", dto.GioKT);
            return test.ExcuteNonQuery("UPDATE_CACHIEU", arrpara);
        }
    }
}
